<?php
defined('BASEPATH') or exit('No direct script access allowed');
session_start();

class Users extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->model("user_model");
        $this->load->helper('url');
    }

    public function index()
    {
        if (!isset($_SESSION["user"])) {
            redirect("login");
            return;
        }
        $data["title"] = "用户管理";

        $users = $this->user_model->getAll();
        $data['users'] = $users;

        $user = $_SESSION["user"];
        $data["nickname"] = $user["nickname"];
        $this->load->view("templates/header", $data);
        $this->load->view("users/users", $data);
        $this->load->view("templates/footer");

    }
}